<?php
class Zend_View_Helper_ShowMenuItemIndex{
    public function showMenuItemIndex($view) {

    	$menu_items = $view->menu_items;
    	$str='';
        $str .= '<table width="960">';
	$str .= '<tr>';
 
        $str .= '<table id="product-table" border="0" cellpadding="0" cellspacing="0" width="100%">';
        $str .= '<tr>';
        $str .= '<th class="table-header-repeat line-left minwidth-1"><a href="">ID</a></th>';
        $str .= '<th class="table-header-repeat line-left minwidth-1"><a href="">Menu ID</a></th>';
        $str .= '<th class="table-header-repeat line-left minwidth-1"><a href="">Tiêu đề</a></th>';
        $str .= '<th class="table-header-repeat line-left minwidth-1"><a href="">Đường dẫn</a></th>';
		$str .= '<th class="table-header-repeat line-left minwidth-1"><a href="">ID Menu trái</a></th>';
        $str .= '<th class="table-header-options line-left minwidth-2"><a href="">ID Menu phải</a></th>';
        $str .= '<th class="table-header-options line-left minwidth-2"><a href="">Thao tác</a></th>';
        $str .= '</tr>';

        $i=0;
        foreach ($menu_items as $item) {
            if($i>=1)
                $i=0;
            else
                $i++;
            
            if($i==1)
                $str .= '<tr>';
            else 
                $str .= '<tr class="alternate-row">';
                
            $str .='<td>'.$item->menu_item_id.'</td>';
            $str .='<td>'.$item->menu_id.'</td>';
            $str .='<td>'.$item->label.'</td>';
            $str .='<td>'.$item->link.'</td>';
			$str .='<td>'.$item->left_id.'</td>';
			$str .='<td>'.$item->right_id.'</td>';
			
            $str .= '<td class="options-width">';
            $str .= '<a title="Sửa" class="icon-1 info-tooltip" href="'.$view->url(array('controller'=>'menuitem', 'action'=>'edit', 'menu_item_id'=>$item->menu_item_id)).'"></a> ';
            $str .= '<a title="Thêm" class="icon-3 info-tooltip" href="'.$view->url(array('controller'=>'menuitem', 'action'=>'add')).'"></a>';
            $str .= '<a title="Xóa" onclick="return confirm(\'Bạn thật sự muốn xóa menu item này?\')" class="icon-2 info-tooltip" href="'.$view->url(array('controller'=>'menuitem', 'action'=>'delete','menu_item_id'=>$item->menu_item_id)).'"></a></td>';
            $str .='</tr>';
        }
        $str .= '</table>';
        
        return $str; 

    }
}